jQuery(function($){

var printAgendaRow = function(data){
	alert(data);
}

var printAgendaDay = function(slots){
	//$.each(slots,printAgendaRow;
		alert('ha');
		alert(slots[1].date);
	}


 var getAgendaData = function(mock){
 if (mock){
	 $.getJSON("/data/agenda_overview.json?='+Date.now()",
			   	function(data){
			   		alert('hat');
			   		alert(data[1].date);
			   	}
			   );
	 }
else{
	$.ajax({ 
		   type: "GET",
		   dataType: "jsonp",
		   url: "http://localhost:8080/hello/get",
		   success: function(data){        
		     alert(data.success);
		   },
		   error: function (xhr, status) {
		   	alert(xhr.status);
		   	alert(xhr);
		   	alert(status);
		   }

		});
	}
}

var createRow = function(){
		
	}

	var clickMe = function(){
			alert('called');
			console.log('called');
		//$.getJSON("http://localhost:8080/hello/get?callback=?",
			/**$.getJSON("/data/agenda_.json?='+Date.now()",
		   function(data) {
		   	alert('test');
		   	console.log("hall");
		   	console.log(data);
		   	$.each(data,function(data){
		   		console.log(data); 

		   	})
		             
		   });**/

		   $.ajax({ 
		   type: "GET",
		   dataType: "json",
		   url: "/data/agenda.json",
		   success: function(data){  
		   	 console.log("success");      
		     alert(data.success);
		     console.log(data[0]);
		   },
		   error: function (xhr, status,errorThrown) {
		   	console.log(xhr.status);
		   	console.log(xhr);
		   	console.log(status);
		   	console.log(errorThrown);
		   }

		});
					


		}


/**
$.getJSON('daten/restaurants.json?='+Date.now(), function(data){
			
			$('#uebersicht').find('ul').html('');
			
			$.each(data, function(restaurant, daten){
				$('#uebersicht').find('ul').
				append('<li class="'+daten.Kategorie+'">
					<img src="http://maps.google.com/maps/api/staticmap?center='+daten.Position.Latitude+','+daten.Position.Longitude+
					'&zoom=13&size=50x50&markers=color:blue|size:tiny|'+daten.Position.Latitude+','+daten.Position.Longitude+
					'&sensor=true"/>'+restaurant+'<span>'+
					entfernungBerechnen(meineLongitude,meineLatitude,daten.Position.Longitude,daten.Position.Latitude)+'</span></li>');
				
		
				
			});
			
		//	window.scrollTo(0,1);
			
		});
**/



 getAgendaData(true);

})